package com.cloud.core.db.mapper;

import com.cloud.core.db.entity.DBEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by cloudy.xie on 17/12/13.
 */
@Mapper
public interface MyDBMapper {

    @Select("select table_name from information_schema.tables where table_schema=#{dataBaseName}")
    List<String> getAllTable(@Param("dataBaseName") String dataBaseName);

    @Select("select column_name,data_type,column_comment from information_schema.COLUMNS where table_schema=#{dataBaseName} and TABLE_NAME=#{tableName}")
    List<DBEntity> getAllColumns(@Param("dataBaseName") String dataBaseName, @Param("tableName") String tableName);
}
